package com.wing.bill.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 账单表账单汇总
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bill_ord_information")
public class BillOrdInformation extends BaseEntity<BillOrdInformation> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum BillStatus implements IEnum<Integer> {

        /**
        * 待审核
        */
        pending(0,"待审核"),
        /**
        * 待确认
        */
        confirm(1,"待确认"),
        /**
        * 结算中
        */
        insettle(2,"结算中"),
        /**
        * 已结算
        */
        settled(3,"已结算");

        private int code;
        private String desc;

        BillStatus(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum InvoiceStatus implements IEnum<Integer> {

        /**
        * 待开票
        */
        pending(0,"待开票"),
        /**
        * 已开票
        */
        invoiced(1,"已开票");

        private int code;
        private String desc;

        InvoiceStatus(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Type implements IEnum<Integer> {

        /**
        * 领用
        */
        collect(0,"领用"),
        /**
        * 修磨
        */
        repair(1,"修磨"),
        /**
        * 回收
        */
        recycle(2,"回收");

        private int code;
        private String desc;

        Type(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum ConfirmResult implements IEnum<Integer> {

        /**
        * 通过
        */
        pass(0,"通过"),
        /**
        * 不通过
        */
        refuse(1,"不通过");

        private int code;
        private String desc;

        ConfirmResult(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum IsDiscount implements IEnum<Integer> {

        /**
        * 参加
        */
        yes(0,"参加"),
        /**
        * 不参加
        */
        no(1,"不参加");

        private int code;
        private String desc;

        IsDiscount(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 账单编码
     */
    private String billNo;

    /**
    * 账单开始时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
    * 账单结束时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 账单包含的订单数量
     */
    private Integer billOrdAmount;

    /**
     * 账单总金额
     */
    private BigDecimal billTotalMoney;

    /**
     * 账单状态
     */
    private BillStatus billStatus;

    /**
    * 账单状态描述
    */
    @TableField(exist = false)
    private String billStatusDesc;

    public String getBillStatusDesc() {
        return billStatus == null ? null : billStatus.getDesc();
    }

    /**
     * 开票状态
     */
    private InvoiceStatus invoiceStatus;

    /**
    * 开票状态描述
    */
    @TableField(exist = false)
    private String invoiceStatusDesc;

    public String getInvoiceStatusDesc() {
        return invoiceStatus == null ? null : invoiceStatus.getDesc();
    }

    /**
     * 审核人
     */
    private String billAuditor;

    /**
     * 审核备注说明
     */
    private String examineRemark;

    /**
     * 账单类型
     */
    private Type type;

    /**
    * 账单类型描述
    */
    @TableField(exist = false)
    private String typeDesc;

    public String getTypeDesc() {
        return type == null ? null : type.getDesc();
    }

    /**
     * 企业名称
     */
    private String enterpriseName;

    /**
     * 企业id
     */
    private Long enterpriseId;

    /**
     * 收款账号
     */
    private String incomeNumber;

    /**
     * 收款账号开户行
     */
    private String incomeBank;

    /**
     * 收款账户
     */
    private String incomeAccount;

    /**
     * 付款账户
     */
    private String payAccount;

    /**
     * 付款开户行
     */
    private String payBank;

    /**
     * 付款账号
     */
    private String payNumber;

    /**
     * 确认结果
     */
    private ConfirmResult confirmResult;

    /**
    * 确认结果描述
    */
    @TableField(exist = false)
    private String confirmResultDesc;

    public String getConfirmResultDesc() {
        return confirmResult == null ? null : confirmResult.getDesc();
    }

    /**
     * 确认备注
     */
    private String confirmRemark;

    /**
     * 确认不通过备注
     */
    private String confirmRefuseRemark;

    /**
     * 账单确认人
     */
    private String confirmName;

    /**
    * 账单确认时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime confirmTime;

    /**
     * 生成订单编号用
     */
    private Integer day;

    /**
     * 序号
     */
    private Integer no;

    /**
     * 是否参加优惠
     */
    private IsDiscount isDiscount;

    /**
    * 是否参加优惠描述
    */
    @TableField(exist = false)
    private String isDiscountDesc;

    public String getIsDiscountDesc() {
        return isDiscount == null ? null : isDiscount.getDesc();
    }

    /**
     * 优惠金额
     */
    private BigDecimal discountMoney;

    /**
     * 优惠后的最终金额
     */
    private BigDecimal finalMoney;

}
